<?php

//Class for pos 54 transaction planning input
class Pos54 extends PosKeterangan {
	//attributes
	public $nilai_rupiah = 0;
	
	public function rules() {
		$rules = parent::rules();
		$rules[] = array('nilai_rupiah', 'safe', 'on'=>'search');
		
		return $rules;
	}
	
	public function searchPos54($nilai_divisi) {
		$criteria=new CDbCriteria;

		$criteria->with = array('poses');
		$criteria->with[] = 'poses.pagus';
		
		$criteria->compare('jenis_pos',54);
		$criteria->compare('jenis_subpos',$this->jenis_subpos);
		$criteria->compare('keterangan',$this->keterangan,true);
		$criteria->compare('pagus.id_divisi',$nilai_divisi);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
			'pagination' => array (
                  'pageSize' => 50,
            ),
			'sort'=>array(
            	'defaultOrder'=>'t.id ASC',
        	),
		));
	}
}

?>